{__NOLAYOUT__}
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>新闻资讯-{$seo_title}</title>
    <include file="Index:meta" />
    <link href="https://cdnjs.cloudflare.com/ajax/libs/Swiper/3.4.2/css/swiper.min.css" rel="stylesheet">
</head>

<body>
    <div id="page">
        <!-- Header -->
        <include file="Index:header" />
        <!-- Header End -->

        <div class="banner hide-sm">
            <img src="__PUBLIC__/dist/image/rank_banner.jpg">
        </div>

        <!-- 项目列表 start -->
        <div class="project container clearfix pt-60">

            <section class="new-main mb-60">
                <div class="new-card clearfix">
                    <!--推荐-->
                    <volist name='tuijian' id="vo" key='k'>
                        <div class="box">
                            <a href='index.php?m=Index&a=newsdetails&id={$vo.id}' title="{$vo.title}">
                                <img src="__PUBLIC__/dist/image/imgNews.jpg" data-big="http://hgedu.fjhgkj.com{$vo.bannerimg}" data-img="http://hgedu.fjhgkj.com{$vo.thumb}">
                                <p class="text-ellipsis">{$vo.title}</p>
                            </a>
                        </div>
                    </volist>
                    <div class="row">
                        <!--热门-->
                        <volist name='remen' id="vo" key='k'>
                            <div class="box">
                                <a href='index.php?m=Index&a=newsdetails&id={$vo.id}' title="{$vo.title}">
                                    <img src="__PUBLIC__/dist/image/img.jpg" data-src="http://hgedu.fjhgkj.com{$vo.thumb}">
                                    <p class="text-ellipsis">{$vo.title}</p>
                                </a>
                            </div>
                        </volist>
                    </div>
                </div>

                <div class="new-type clearfix pt-40">
                    <a class="pull-left active" data-catid='23'>学校</a>
                    <a class="pull-left "data-catid='24'>业界</a>
                    <a class="pull-left "data-catid='25'>企业</a>
                    <a class="pull-left visible-xs">公告</a>
                    <a class="pull-left visible-xs">文件</a>
                </div>
                <div class="new-list">
                    <ul id="schoolid">
                    </ul>
                    <a class="btn-more" data-p='1'>加载更多</a>
                </div>

            </section>

            <aside class="new-aside">
                <div class="list-aside">
                    <a href="index.php?m=Index&a=notice&pid=26" class="pull-right">更多&gt;</a>
                    <h2>公告</h2>
                    <ul>
                        <volist name='gonggao' id="vo" key='k'>
                            <li class="text-ellipsis">
                                <a href='index.php?m=Index&a=newsdetails&id={$vo.id}'>{$vo.title} </a>
                            </li>
                        </volist>
                    </ul>
                </div>

                <div class="list-aside">
                    <a href="index.php?m=Index&a=notice&pid=27" class="pull-right">更多&gt;</a>
                    <h2>文件</h2>
                    <ul>
                        <volist name='wenjian' id="vo" key='k'>
                            <li class="text-ellipsis">
                                <a href='index.php?m=Index&a=newsdetails&id={$vo.id}'>{$vo.title}</a>
                            </li>
                        </volist>
                    </ul>
                </div>
            </aside>

        </div>

        <include file="Index:footer" />
    </div>
    <i class="goTop"></i>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/Swiper/3.4.2/js/swiper.min.js"></script>

    <script>
        $(function () {
            
            var obj = $("[data-big]");
            var img = new Image();
            img.src = obj.data("big");
            img.onload = function () {
                obj.attr("src",obj.data("big"));
                var h = obj.width() / (880/240) + "px";
                obj.css("height",h)
            };
            img.onerror = function () {
                obj.src = "__PUBLIC__/dist/image/imgBig.jpg"
            }
            
            function newCard(){
                var obj = $(".new-card");
                var group = obj.find(".box");
                var html = '<div class="new-card swiper-container">';
                        html+= '<div class="swiper-wrapper">';
                            group.each(function(){
                                html += '<div class="swiper-slide">';
                                    html += $(this).html();
                                html += '</div>'
                            })
                        html+= '</div>';
                    html+= '</div>';
                obj.html(html);
                
                obj.find("img").each(function(){
                    if($(this).data("img")){
                        console.log($(this).data("img"))
                        $(this).attr("src", $(this).data("img"))
                    }
                })

                var swiper = new Swiper('.swiper-container', {
                    autoplay: 3000, //可选选项，自动滑动
                })
            }
            if($(window).width() < 788){
                newCard();
            }


            $("#schoolid").on("click", ".zan", function () {
                // 点赞
                var nid = $(this).find("i").data('aid');
                $.ajax({
                    type: "POST",
                    url: "index.php?g=Home&m=Index&a=zanarticle",
                    data: "nid=" + nid,
                    dataType: "json",
                    success: function (resp) {
                        if (resp.code == '0002') {
                            alert(resp.msg);
                            window.location.href = 'http://user.fjhgkj.com.cn/index.php?u=jzzy&url={$url1}';
                        } else if (resp.code == '0000') {
                            $("#schoolid #art" + nid).find("span").html(resp.zan);
                            $("#schoolid #art" + nid).find("i").addClass("on")
                            alert(resp.msg);
                        } else {
                            alert(resp.msg);
                        }
                    }
                });

            })
        })

        $(function () {
            var i = 1;
            $('.new-type a').on('click', function () {
                if ($(this).hasClass('active')) {
                    // alert('您已经在这个栏目了，请点击别的栏目');
                    return false;
                }

                if($(window).width() < 768){
                    var index = $(this).html();
                    $(".new-list").hide();
                    $(".list-aside").hide();
                    if(index == "公告"){
                        $(".list-aside").eq(0).show();
                    }else if(index == "文件"){
                        $(".list-aside").eq(1).show();
                    }else{
                        $(".new-list").show();
                    }
                }


                $("#schoolid").html('');
                $('.btn-more').attr("data-p", 1);
                $('.btn-more').html("加载更多");
                i = 1;
                var catid = $(this).data('catid');
                $('.new-type a').removeClass("active");
                $(this).addClass("active");
                refreshlist(catid, 1);
            })

            //加载更多
            $('.btn-more').on('click', function () {
                i = i + 1;
                var cat = $('.new-type a.active').data('catid');
                refreshlist(cat, i);
            })
        })

        function refreshlist(aa, bb) {
            $.ajax({
                type: "POST",
                url: "index.php?g=Home&m=Index&a=getnews",
                data: "catid=" + aa + "&page=" + bb,
                dataType: "json",
                success: function (resp) {
                    if (resp != null) {
                        var strHTML = '';
                        $.each(resp, function (k, item) {

                            strHTML += '<li class="clearfix"><a href="index.php?m=Index&a=newsdetails&id=' + item.id + '"><img src="__PUBLIC__/dist/image/img.jpg" data-src="http://hgedu.fjhgkj.com' + item.thumb + '">';
                            strHTML += '<h3 class="text-ellipsis">' + item.title + '</h3></a><p>' + item.description + '</p>';
                            strHTML += '<div class="card-info-item clearfix">';
                            strHTML += '<label><i class="icon-fwl"></i>' + item.hits + '</label>';
                            if (item.yizan == 2) {
                                strHTML += '<label><a class="zan" id="art' + item.id + '"><i class="icon-zan" data-aid="' + item.id + '"></i><span>' + item.zan + '</span></a></label>';
                            } else {
                                strHTML += '<label><a class="zan" id="art' + item.id + '"><i class="icon-zan on" data-aid="' + item.id + '"></i><span>' + item.zan + '</span></a></label>';
                            }
                            strHTML += '<label class="pull-right"><i class="icon-time"></i>' + item.createtime + '</label></div></li>';

                        });
                        $("#schoolid").append(strHTML);
                        // 初始化懒加载
                        srcollLoadImg();
                    } else {
                        $(".btn-more").html('没有更多');
                    }
                }
            });
        }

        refreshlist(23, 1);
    </script>
</body>

</html>